import 'package:flutter/material.dart';

/// 添加边框
class BorderWidget extends StatelessWidget {
  final bool? isInk; //是否水波纹控件
  final double? radius; //圆角大小
  final Widget? child; //子控件
  final double? width;
  final double? height;
  final Color? borderColor; //边框颜色
  final double borderWidth; //边框大小
  final Color? backgroundColor; //背景色

  BorderWidget({
    Key? key,
    this.isInk,
    this.radius = 33,
    this.child,
    this.width,
    this.height,
    this.borderColor = Colors.white,
    this.borderWidth = 1,
    this.backgroundColor = Colors.transparent,
  }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    Decoration _decoration = BoxDecoration(
      border: Border.all(
        color: borderColor!,
        width: borderWidth,
      ),
      color: backgroundColor,
      borderRadius: BorderRadius.all(Radius.circular(radius!)),
    );
    if (isInk == true) {
      return Ink(
        width: width,
        height: height,
        decoration: _decoration,
        child: child,
      );
    } else {
      return Container(
        width: width,
        height: height,
        decoration: _decoration,
        child: child,
      );
    }
  }
}
